#ifndef _FTPPOOL_HPP
#define _FTPPOOL_HPP

#include "ftpenv.hpp"
#include <string>
#include <curl/curl.h>
#include <WinBase.h>

namespace com_oocl_monitor {
	namespace system {
		typedef CURL Connection;
		class FtpPool
		{
		public:
			FtpPool(const std::string& host, const std::string& port = "", const std::string& usr = "", const std::string& pwd = "", unsigned int maxCon = 5);
			~FtpPool();
			Connection *getConnection();
			void releaseConnection(Connection *con);
			std::string Host()
			{
				return _host;
			}
			std::string Port()
			{
				return _port;
			}
			std::string Usr()
			{
				return _usr;
			}
			std::string Pwd()
			{
				return _pwd;
			}
		private:
			FtpPool(const FtpPool&);
			FtpPool &operator=(const FtpPool&);
		private:
			CurlEnv *_ftpEnv;
			std::string _host;
			std::string _port;
			std::string _usr;
			std::string _pwd;
			unsigned int _maxCon;
		private:
			HANDLE _sem;
		};
	}
}

#endif // _FTPPOOL_HPP
